var calendar = {	
		
	getEvents: function(date){
		var oThis = this;
		var month = date.getMonth() +1;
		var theDate = date.getFullYear()+"-"+month+"-"+date.getDate();
		window.location = "./bydate.html?date="+theDate;
	},
	
	renderExtjs: function(divId){
		var oThis = this;
		Ext.onReady(function(){
			Ext.create('Ext.panel.Panel', {
			    title: 'Selecciona una fecha',
			    width: 265,
			    border:false,
			    header: false,
			    renderTo: divId,
			    items: [{
			        xtype: 'datepicker',
			        width: 263,
			        footer: false,
			        minDate: new Date(),
			        handler: function(picker, date) {
			        	picker.setLoading(true);
			            oThis.getEvents(date);
			            picker.setLoading(false);
			        }
			    }]
			});
		});
	}
};